package PrintStream_PrintWriter;

import java.util.*;
import java.io.*;

public class PrintStream_PrintWriterDemo {

	public static void main(String[] args) throws IOException, ClassNotFoundException {

//		PrintStream ps = new PrintStream("E:\\File练习\\字节打印流");
//		
//		ps.println("abcabc");
//		
//		ps.close();
//		
//		
//		PrintWriter pw = new PrintWriter("E:\\File练习\\字符打印流");
//		pw.println("我是大帅哥");
//		pw.flush();
//		pw.println("大帅哥是我");
//		pw.flush();
//
//		pw.close();
		
//		write();
		read();

	}

	public static void write() throws FileNotFoundException, IOException, ClassNotFoundException {
		ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("E:\\File练习\\对象序列化"));
		Stu s1 = new Stu(11, "陈冠希");
		oos.writeObject(s1);
		oos.close();
		
	}
	public static void read() throws FileNotFoundException, IOException, ClassNotFoundException {
		ObjectInputStream ois = new ObjectInputStream(new FileInputStream("E:\\File练习\\对象序列化"));
		Object oj = ois.readObject();
		Stu s = (Stu) oj;
		System.out.println(s.getAge() + "," + s.getName());
		
	}

}
